﻿using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Data;
using System.Windows.Media;
using CI.Models.Production;

namespace CI.UI.Prototypes
{
    public class PILevelBackgroundColorConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            try
            {
                var level = value is PIManufacturingLevel ? (PIManufacturingLevel) value : PIManufacturingLevel.Resource;

                return (Brush) Application.Current.FindResource("PILevel." + level);
            }
            catch (Exception)
            {
                return Brushes.Transparent;
            }
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
}
